<template>
  <div>
    <MyHeader title="tabbar案例"></MyHeader>
    <div class="main">
      <component :is="username"></component>
    </div>
    <MyTabBar :arr="tabList" @changeBar="changeFn"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeder";
import MyTabBar from "./components/MyTabBar";
import MyGoodsList from "./views/MyGoodsList";
import MyGoodsSearch from "./views/MyGoodsSearch";
import MyUserInfo from "./views/MyUserInfo";
export default {
    methods:{
      changeFn(index){
        this.username = this.tabList[index].componentName
      }
    },
  components: {
    MyHeader,
    MyTabBar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo,
  },
  data() {
    return {
      username: "MyGoodsList",
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo",
        },
      ],
    };
  },
};
</script>

<style scoped>
.main {
  padding: 45px 0 50px 0;
}
</style>

